package com.ruoyi.business.controller;

import com.ruoyi.business.dto.EnterpriseVideoRecordDTO;
import com.ruoyi.common.core.domain.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.business.domain.EnterpriseVideoRecord;
import com.ruoyi.business.service.IEnterpriseVideoRecordService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 企业观看视频记录Controller
 * 
 * @author lcz
 * @date 2025-01-19
 */
@Api(tags = "企业观看视频记录相关接口")
@RestController
@RequestMapping("/business/enterpriseVideoRecord")
public class EnterpriseVideoRecordController extends BaseController
{
    @Autowired
    private IEnterpriseVideoRecordService enterpriseVideoRecordService;

    /**
     * 查询企业观看视频记录列表
     */
    @ApiIgnore
    @PreAuthorize("@ss.hasPermi('business:enterpriseVideoRecord:list')")
    @GetMapping("/list")
    public TableDataInfo list(EnterpriseVideoRecord enterpriseVideoRecord)
    {
        startPage();
        List<EnterpriseVideoRecord> list = enterpriseVideoRecordService.selectEnterpriseVideoRecordList(enterpriseVideoRecord);
        return getDataTable(list);
    }

    /**
     * 导出企业观看视频记录列表
     */
    @ApiIgnore
    @PreAuthorize("@ss.hasPermi('business:enterpriseVideoRecord:export')")
    @Log(title = "企业观看视频记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, EnterpriseVideoRecord enterpriseVideoRecord)
    {
        List<EnterpriseVideoRecord> list = enterpriseVideoRecordService.selectEnterpriseVideoRecordList(enterpriseVideoRecord);
        ExcelUtil<EnterpriseVideoRecord> util = new ExcelUtil<EnterpriseVideoRecord>(EnterpriseVideoRecord.class);
        util.exportExcel(response, list, "企业观看视频记录数据");
    }

    /**
     * 获取企业观看视频记录详细信息
     */
    @ApiIgnore
    @PreAuthorize("@ss.hasPermi('business:enterpriseVideoRecord:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(enterpriseVideoRecordService.selectEnterpriseVideoRecordById(id));
    }

    /**
     * 新增企业观看视频记录
     */
    @ApiIgnore
    @PreAuthorize("@ss.hasPermi('business:enterpriseVideoRecord:add')")
    @Log(title = "企业观看视频记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody EnterpriseVideoRecord enterpriseVideoRecord)
    {
        return toAjax(enterpriseVideoRecordService.insertEnterpriseVideoRecord(enterpriseVideoRecord));
    }

    /**
     * 修改企业观看视频记录
     */
    @ApiIgnore
    @PreAuthorize("@ss.hasPermi('business:enterpriseVideoRecord:edit')")
    @Log(title = "企业观看视频记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody EnterpriseVideoRecord enterpriseVideoRecord)
    {
        return toAjax(enterpriseVideoRecordService.updateEnterpriseVideoRecord(enterpriseVideoRecord));
    }

    /**
     * 删除企业观看视频记录
     */
    @ApiIgnore
    @PreAuthorize("@ss.hasPermi('business:enterpriseVideoRecord:remove')")
    @Log(title = "企业观看视频记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(enterpriseVideoRecordService.deleteEnterpriseVideoRecordByIds(ids));
    }

    /** 前端接口 ***************************************************************************************************/
    /** 前端接口 ***************************************************************************************************/
    /** 前端接口 ***************************************************************************************************/

//    /**
//     * 查询企业观看视频记录列表
//     * 接口路径：/enterpriseVideoRecord/front/list
//     */
//    @GetMapping("/front/list")
//    @ApiOperation("前台查询企业观看视频记录列表")
//    public TableDataInfo frontList(EnterpriseVideoRecord enterpriseVideoRecord)
//    {
//        startPage();
//        List<EnterpriseVideoRecord> list = enterpriseVideoRecordService.selectEnterpriseVideoRecordList(enterpriseVideoRecord);
//        return getDataTable(list);
//    }
//
//    /**
//     * 获取企业观看视频记录详细信息
//     * 接口路径：/enterpriseVideoRecord/front/info
//     */
//    @ApiOperation("前台获取企业观看视频记录详细信息")
//    @GetMapping(value = "/front/info")
//    public R<EnterpriseVideoRecord> frontInfo(@RequestParam("id") Long id)
//    {
//        return R.ok(enterpriseVideoRecordService.selectEnterpriseVideoRecordById(id));
//    }
//
//    /**
//     * 新增企业观看视频记录
//     * 接口路径：/enterpriseVideoRecord/front/add
//     */
//    @ApiOperation("前台新增企业观看视频记录")
//    @PostMapping("/front/add")
//    public AjaxResult frontAdd(@RequestBody EnterpriseVideoRecord enterpriseVideoRecord)
//    {
//        return toAjax(enterpriseVideoRecordService.insertEnterpriseVideoRecord(enterpriseVideoRecord));
//    }
//
//    /**
//     * 修改企业观看视频记录
//     * 接口路径：/enterpriseVideoRecord/front/edit
//     */
//    @ApiOperation("前台修改企业观看视频记录")
//    @PostMapping("/front/edit")
//    public AjaxResult frontEdit(@RequestBody EnterpriseVideoRecord enterpriseVideoRecord)
//    {
//        return toAjax(enterpriseVideoRecordService.updateEnterpriseVideoRecord(enterpriseVideoRecord));
//    }
//
//    /**
//     * 删除企业观看视频记录
//     * 接口路径：/enterpriseVideoRecord/front/delete
//     */
//    @ApiOperation("前台删除企业观看视频记录")
//    @GetMapping("/front/delete")
//    public AjaxResult frontRemove(@RequestParam Long[] ids)
//    {
//        return toAjax(enterpriseVideoRecordService.deleteEnterpriseVideoRecordByIds(ids));
//    }
    /**
     * 记录视频观看进度
     * 接口路径：/enterpriseVideoRecord/front/add
     */
    @ApiOperation("记录视频观看进度")
    @PostMapping("/front/add")
    public AjaxResult frontAdd(@RequestBody EnterpriseVideoRecordDTO dto)
    {
        return enterpriseVideoRecordService.frontAdd(dto);
    }
}
